/*
 * @lc app=leetcode.cn id=461 lang=java
 *
 * [461] 汉明距离
 */

// @lc code=start
class Solution {
    public int hammingDistance(int x, int y) {
        int z = x^y;//异或
        int sum =0;
        while(z!=0){
            sum += z & 1;
            z = z>>1;//右移一位
        }
        return sum;
    }
}
// @lc code=end

